perm filename DV.CH2[MF,ALS] blob sn#788421 filedate 1985-04-04 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00007 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	@x Tell WEAVE to print only the changes:
C00003 00003	@x Printing goes to terminal
C00004 00004	@x Specify compiler directives:
C00005 00005	@x Opening packed binary files:
C00009 00006	@x Set up terminal I/O:
C00010 00007	@x file_name type
C00011 ENDMK
C⊗;
@x Tell WEAVE to print only the changes:
	\centerline{\hsize 5in\baselineskip9pt
		\vbox{\ninerm\noindent
		The preparation of this report
		was supported in part by the National Science
		Foundation under grants IST-8201926 and MCS-8300984,
		and by the System Development Foundation. `\TeX' is a
		trademark of the American Mathematical Society.}}}
@y
\centerline{(This listing shows the changes for {\sc TOPS-20} only)}}
\let\maybe=\iffalse
@z
@x Printing goes to terminal
@d print(#)==write(#)
@d print_ln(#)==write_ln(#)
@y
@d print(#)==write(tty,#)
@d print_ln(#)==write_ln(tty,#)
@z
@x Specify compiler directives:
@p program DVI_IMP(@!dvi_file,@!im_file,@!output);
@y
@p @t\4@>@{$D+,W+@} {no debugging overhead}
program DVI_IMP;
@z
@x Opening packed binary files:
@p procedure open_dvi_file; {prepares to read packed bytes in |dvi_file|}
begin reset(dvi_file);
cur_loc←0;
end;
@#
procedure open_gf_file; {prepares to read packed bytes in |gf_file|}
begin reset(gf_file,cur_name);
cur_gf_loc←0;
end;
@#
procedure open_tfm_file; {prepares to read packed bytes in |tfm_file|}
begin reset(tfm_file,cur_tfm_name);
end;
@y
@p procedure esp(var dvi_file,im_file:f@&i@&l@&e); extern; @t\2@>@/
	{spools the |im_file| under the |dvi_file| name}
@#
function rescan:boolean; extern; @t\2@>@;
	{puts the command line into the terminal buffer,
	or returns |false| if there was no command line}
@#
procedure cur_nam(var chan:f@&i@&l@&e;var s:string); extern; @t\2@>@/
@#
function erstat(var f:file):integer; extern;@t/2@>
@#
procedure open_dvi_file; {prepares to read packed bytes in |dvi_file|}
label 223;
var i:integer;
@!seen_dot: boolean;
begin
if rescan then begin
	read_ln(tty);
	while (¬ eoln(tty))∧(tty↑≠';') do get(tty);
	end;
if eoln(tty) then write(tty,'DVI file? ');
223:
i←1;
get(tty);
seen_dot←false;
while ¬ eoln(tty) do begin
	if tty↑='.' then seen_dot←true
	dvi_name[i]←tty↑; incr(i); get(tty);
	end;
if not seen_dot then begin
	dvi_name[i]←'.'; incr(i);
	dvi_name[i]←'D'; incr(i);
	dvi_name[i]←'V'; incr(i);
	dvi_name[i]←'I'; incr(i);
	end;
while i<f_name_size do begin dvi_name[i]←' '; incr(i); end;
reset(dvi_file,dvi_name,'/B:8/O');
if (erstat(dvi_file) mod @'20000) > 0 then begin
	write(tty,'.DVI file? ');
	goto 223;
	end;
cur_loc←0;
end;
@#
procedure open_gf_file; {prepares to read packed bytes in |gf_file|}
begin reset(gf_file,cur_name,'/B:8/O/N:9');
cur_gf_loc←0;
end;
@#
procedure open_tfm_file; {prepares to read packed bytes in |tfm_file|}
begin reset(tfm_file,cur_tfm_name,'/B:8');
cur_gf_loc←0;
end;
@z

@x
@p procedure open_im_file; {prepares to write packed bytes in |im_file|}
begin rewrite(im_file); im_byte_no←0;
end;
@y
@p procedure open_im_file; {prepares to write packed bytes in |im_file|}
var i,j:integer;
begin
cur_nam(dvi_file,imp_name);
i←1;
while imp_name[i]>'@@' do i←i+1; {skip to dot or bracket or space}
j←i-1;
imp_name[i]←'.'; incr(i);
imp_name[i]←'I'; incr(i);
imp_name[i]←'M'; incr(i);
imp_name[i]←'P'; incr(i);
imp_name[i]←' ';
rewrite(im_file,imp_name,'/B:8/N:9/P:256');
im_byte_no←0;
end;
@z
@x Set up terminal I/O:
and |term_out| for terminal output.
@↑system dependencies@>

@<Glob...@>=
@!buffer:array[0..terminal_line_length] of ASCII_code;
@!term_in:text_file; {the terminal, considered as an input file}
@!term_out:text_file; {the terminal, considered as an output file}
@y
and |term_out| for terminal output.
@↑system dependencies@>

@d term_in==tty
@d term_out==tty

@<Glob...@>=
@!buffer:array[0..terminal_line_length] of ASCII_code;
@z
@x file_name type
itself will get a new section number.
@↑system dependencies@>
@y
itself will get a new section number.
@↑system dependencies@>

@<Const...@>=
@!f_name_size=24;

@ @<Type...@>=
@!file_name=packed array[1..f_name_size] of char;

@ @<Glob...@>=
@!imp_name,
@!dvi_name:file_name;
@!dvi_n_len:1..f_name_size; {file names at {\sc SAIL} have at most 23 characters}
@z